package com.smartboot.plus.features;

import com.smartboot.plus.utils.INetUtil;
import tech.smartboot.mqtt.plugin.spec.BrokerContext;

public class NodeUtil {

    public static String getNodeId(BrokerContext brokerContext) {
        // 初始化逻辑
        if (brokerContext.Options().getHost().equals("0.0.0.0")) {
            return brokerContext.Options().getNodeId() + "@" + INetUtil.getHostIp();
        } else {
            return brokerContext.Options().getNodeId() + "@" + brokerContext.Options().getHost();
        }
    }
}
